#pragma once 
#include<string>
#include<map>
#include"MysqlMgr.h"
class IThresholdMgr {
public:
	virtual ~IThresholdMgr() = default;
	virtual bool UpdateDeviceThresholdItemAck(const std::string& device_id, int item_code) = 0;
	virtual bool InitDeviceThresholdItems(const std::string& device_id) = 0;
	virtual bool GetDeviceUnAckItemsWithValue(const std::string& device_id,std::map<int, float>& unack_items) = 0;
	virtual bool UpdateItemSendTime(const std::string& device_id, int item_code) = 0;
};
class ThresholdMgr_DB : public IThresholdMgr {
public:
	bool UpdateDeviceThresholdItemAck(const std::string& device_id, int item_code) {
		MysqlMgr::GetInstance()->UpdateDeviceThresholdItemAck(device_id, item_code);
	}
	bool InitDeviceThresholdItems(const std::string& device_id) {
		MysqlMgr::GetInstance()->InitDeviceThresholdItems(device_id);
	}
	bool GetDeviceUnAckItemsWithValue(const std::string& device_id, std::map<int, float>& unack_items) {
		MysqlMgr::GetInstance()->GetDeviceUnAckItemsWithValue(device_id, unack_items);
	}
	bool UpdateItemSendTime(const std::string& device_id, int item_code) {
		MysqlMgr::GetInstance()->UpdateItemSendTime(device_id, item_code);
	}
};